﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.BlackApart.Business.Reservations;
using blackhouse.BlackApart.Data;

namespace blackhouse.BlackApart.Business.ApartmentServices {
    public class ReservationAdditionalServicePerNight : DaReservationAdditionalService {

        #region Constuctors

        public ReservationAdditionalServicePerNight(IWebReservation reservation, IAdditionalService service, IAdditionalServiceDataAccess dataAccess)
            : base(reservation, service, dataAccess) { }

        #endregion

        #region Methods

        public override void BookService() {
            DateTime st = this.reservation.ArrivalDate.Date;
            DateTime et = this.reservation.DepartureDate.AddDays(-1).Date;
            if (this.Service.ServiceTime == ServiceTime.Morning) {
                st = st.AddDays(1);
                et = et.AddDays(1);
            }
            while (st <= et) {
                this.AddServiceForDay(st, this.reservation.ApartmentReservation.Length);
                st = st.AddDays(1);
            }
        }

        public void BookService(DateTime forDay) {
            this.AddServiceForDay(forDay, this.reservation.ApartmentReservation.Length);
        }

        #endregion

    }
}
